package com.example.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.entity.AirQualitySensor;
import com.example.entity.InfraredSensor;
import com.example.entity.Params;
import com.example.repository.AirQualitySensorMapper;
import com.example.repository.InfraredSensorMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class InfraredSensorService extends ServiceImpl<InfraredSensorMapper, InfraredSensor> {

    @Resource
    private InfraredSensorMapper infraredSensorMapper;


    public PageInfo<InfraredSensor> findBySearchOfINS(Params params){
        PageHelper.startPage(params.getPageNum(),params.getPageSize());
        List<InfraredSensor> search = infraredSensorMapper.findBySearchOfINS(params);
        return PageInfo.of(search);
    }

    public void addINS(InfraredSensor infraredSensor){
        infraredSensorMapper.insert(infraredSensor);
    }

    public void deleteINS(Long id) {
        infraredSensorMapper.deleteById(id);
    }
}
